﻿using Md.Api.DDD;
using Md.Api.Model.Manage.MdUser.Request;
using Md.Dapper.Repositories.Md;

namespace Md.Api.Service.Manage.MdUser;
/// <summary>
/// 通过用户编号重置用户密码服务
/// </summary>
public class ResetMdUserPwdByUserIdService : ApiBase<RequestResetMdUserPwdByUserIdModel>
{
    /// <summary>
    /// 用户仓储
    /// </summary>
    public MdUserRep mdUserRep { get; set; }
    /// <summary>
    /// 执行
    /// </summary>
    protected override void ExecuteMethod()
    {
        var pwd = EncrptyHelp.MD5Pwd(Parameter.UserPwd);

        var res = mdUserRep.UpdateMdUserPwdByUserId(Parameter.UserId, pwd);

        Result.Data = res > 0 ? "密码重置成功" : "密码重置失败";
    }
}

